import http from '@/utils/common/http'

/**
 * 文件上传
 * */
export async function uploadAttachment (data, conf) {
  return http({
    method: 'post',
    url: '/common/attachment/upload',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data,
    conf
  })
}

/**
 * 文件下载
 * */
export async function downloadAttachment (data) {
  return http({
    method: 'post',
    url: '/common/attachment/download',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data
  })
}

/**
 * 文件安全下载
 * */
export async function secureDownloadAttachment (data) {
  return http({
    method: 'post',
    url: '/common/attachment/secureDownload',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data
  })
}

/**
 * 文件删除
 * */
export async function deleteAttachment (data) {
  return http({
    method: 'post',
    url: '/common/attachment/delete',
    header: {
      'Content-Type': 'application/json;charset=utf-8'
    },
    data
  })
}

/**
 * 文件删除
 * */
export async function getAllCodeByType (data) {
  return http({
    method: 'post',
    url: '/common/code/getCodeByType',
    header: {
      'Content-Type': 'application/json;charset=utf-8'
    },
    data
  })
}
